﻿@page "/tree"
@inject IStringLocalizer<Trees> Localizer
@inject IStringLocalizer<Foo> LocalizerFoo

<h3>@Localizer["TreesTitle"]</h3>
<h4>@Localizer["TreesDescription"]</h4>

<Tips class="mt-3">
    @((MarkupString)Localizer["TreeIntro"].Value)
</Tips>

<DemoBlock Title="@Localizer["TreesNormalTitle"]"
           Introduction="@Localizer["TreesNormalIntro"]"
           Name="Normal">
    <p>
        @((MarkupString)Localizer["TreesNormalDescription"].Value)
    </p>
    <Tree Items="@Items" OnTreeItemClick="@OnTreeItemClick" />
    <ConsoleLogger @ref="Logger1" />
</DemoBlock>

<DemoBlock Title="@Localizer["TreesCheckboxTitle"]"
           Introduction="@Localizer["TreesCheckboxIntro"]"
           Name="Checkbox">
    <p>
        @((MarkupString)Localizer["TreesCheckboxDescription"].Value)
    </p>
    <Tree Items="@CheckedItems" ShowCheckbox="true" OnTreeItemChecked="@OnTreeItemChecked" />
    <ConsoleLogger @ref="Logger2" />
</DemoBlock>

<DemoBlock Title="@Localizer["TreesShowRadioTitle"]"
           Introduction="@Localizer["TreesShowRadioIntro"]"
           Name="ShowRadio">
    <p>
        @((MarkupString)Localizer["TreesShowRadioDescription"].Value)
    </p>
    <Tree Items="@CheckedItems" ShowRadio="true" />
</DemoBlock>

<DemoBlock Title="@Localizer["TreesDisableTitle"]"
           Introduction="@Localizer["TreesDisableIntro"]"
           Name="Disable">
    <p>
        @((MarkupString)Localizer["TreesDisableDescription"].Value)
    </p>
    <Tree Items="@DisabledItems" ShowCheckbox="true" />
</DemoBlock>

<DemoBlock Title="@Localizer["TreesAccordionModelTitle"]"
           Introduction="@Localizer["TreesAccordionModelIntro"]"
           Name="AccordionModel">
    <p>@((MarkupString)Localizer["TreesAccordionModelDescription"].Value)</p>
    <Tree Items="@AccordionItems" ShowCheckbox="true" IsAccordion="true" />
</DemoBlock>

<DemoBlock Title="@Localizer["TreesDefaultExpandTitle"]"
           Introduction="@Localizer["TreesDefaultExpandIntro"]"
           Name="DefaultExpand">
    <p>
        @((MarkupString)Localizer["TreesDefaultExpandDescription"].Value)
    </p>
    <Tree Items="@ExpandItems" ShowCheckbox="true" />
</DemoBlock>

<DemoBlock Title="@Localizer["TreesDisplayIconTitle"]"
           Introduction="@Localizer["TreesDisplayIconIntro"]"
           Name="DisplayIcon">
    <p>
        @((MarkupString)Localizer["TreesDisplayIconDescription"].Value)
    </p>
    <Tree Items="@GetIconItems()" ShowIcon="true" ShowCheckbox="true" />
</DemoBlock>

<DemoBlock Title="@Localizer["TreesClickExpandTitle"]"
           Introduction="@Localizer["TreesClickExpandIntro"]"
           Name="ClickExpand">
    <p>
        @((MarkupString)Localizer["TreesClickExpandDescription"].Value)
    </p>
    <Tree Items="@ClickExpandItems" ShowIcon="true" ShowCheckbox="true" ClickToggleNode="true" />
</DemoBlock>

<DemoBlock Title="@Localizer["TreesValidationFormTitle"]"
           Introduction="@Localizer["TreesValidationFormIntro"]"
           Name="ValidationForm">
    <p>
        @((MarkupString)Localizer["TreesValidationFormDescription"].Value)
    </p>
    <ValidateForm Model="@Model">
        <Tree Items="@ValidateItems" OnTreeItemClick="@OnTreeItemClick" ShowCheckbox="true" />
    </ValidateForm>
</DemoBlock>

<DemoBlock Title="@Localizer["TreesLazyLoadingTitle"]"
           Introduction="@Localizer["TreesLazyLoadingIntro"]"
           Name="LazyLoading">
    <p>
        @((MarkupString)Localizer["TreesLazyLoadingDescription"].Value)
    </p>
    <Tree ClickToggleNode="true" Items="@GetLazyItems()" OnExpandNode="OnExpandNode" />
</DemoBlock>

<DemoBlock Title="@Localizer["TreesCustomNodeTitle"]"
           Introduction="@Localizer["TreesCustomNodeIntro"]"
           Name="CustomNode">
    <Tree ClickToggleNode="true" Items="GetTemplateItems()" />
</DemoBlock>

<DemoBlock Title="@Localizer["TreesNodeColorTitle"]"
           Introduction="@Localizer["TreesNodeColorIntro"]"
           Name="NodeColor">
    <Tree ClickToggleNode="true" Items="GetColorItems()" />
</DemoBlock>

<DemoBlock Title="@Localizer["TreesCheckedItemsTitle"]"
           Introduction="@Localizer["TreesCheckedItemsIntro"]"
           Name="CheckedItems">
    <Tree ShowCheckbox="true" Items="@Items2" OnTreeItemChecked="@OnTreeItemChecked2" />
    <ConsoleLogger @ref="Logger3" />
</DemoBlock>

<DemoBlock Title="@Localizer["TreesShowSkeletonTitle"]"
           Introduction="@Localizer["TreesShowSkeletonIntro"]"
           Name="ShowSkeleton">
    <Button Text="@Localizer["TreesShowSkeletonButtonText"]" IsAsync="true" Icon="fa-solid fa-font-awesome" OnClick="OnLoadAsyncItems" />
    <Tree Items="@AsyncItems" ShowSkeleton="true" class="mt-3" />
</DemoBlock>

<AttributeTable Items="@GetAttributes()" />

<AttributeTable Items="@GetTreeItemAttributes()" Title="@Localizer["TreeItem"]" />
